Skip to content

Conversation

@pbennett1-godaddy
Copy link
Contributor

Summary


Add Storefront Components with Product Grid, Cart, and GraphQL Schema Refactoring

Summary

This PR introduces a complete storefront solution for GoDaddy Commerce, including product browsing, product details, and cart functionality. It also refactors the GraphQL schema organization to
namespace different API endpoints (Catalog Storefront, Checkout, and Orders Storefront).

Changes

🎨 New Storefront Components

Added a comprehensive set of React components for building storefronts:

  • ProductGrid - Displays products in a responsive grid layout with loading skeletons
  • ProductCard - Individual product card with image, name, and pricing
  • ProductDetails - Full product detail page with image carousel, options, and variant selection
  • Cart - Slide-out cart drawer with line items and totals
  • CartLineItems & CartTotals - Modular cart sub-components

Files:

  • packages/react/src/components/storefront/ (6 new files)

🧩 New UI Components

Added reusable shadcn-style UI components:

  • Badge - For displaying labels and tags
  • Card - Container component with header, content, and footer sections
  • Carousel - Image carousel with navigation and indicators
  • Link - Router-aware link component

Files:

  • packages/react/src/components/ui/ (4 new files)

🔄 GraphQL Schema Refactoring

Reorganized GraphQL schemas into separate namespaced files for better maintainability:

  • Split monolithic graphql-env.ts into three domain-specific files:
    • catalog-storefront-env.ts (10,382 lines) - Product catalog and SKU queries
    • checkout-env.ts (11,117 lines) - Checkout and order mutations
    • orders-storefront-env.ts (5,086 lines) - Order management queries
  • Renamed and organized queries/mutations:
    • queries.ts → checkout-queries.ts
    • mutations.ts → checkout-mutations.ts
    • Added catalog-storefront-queries.ts
  • Created separate gql.tada instances for each schema namespace

Files:

  • Deleted: packages/react/src/lib/godaddy/graphql-env.ts
  • Added: 3 new schema files, 3 new gql.tada files
  • Renamed: 2 query/mutation files

🔌 Provider Enhancements

Extended GoDaddyProvider with storefront context:

  • Added storeId and clientId to provider context
  • Enhanced context for storefront components to access store configuration
  • Updated useVariables hook to support dynamic styling

Files:

  • packages/react/src/godaddy-provider.tsx
  • packages/react/src/hooks/use-variables.tsx

📦 Example Implementation

Added complete Next.js example demonstrating storefront features:

  • Product listing page at /store
  • Product detail pages at /store/product/[skuId]
  • Cart functionality at /store/cart
  • Updated providers to include storefront configuration

Files:

  • examples/nextjs/app/store/ (7 new files)

🛠️ Additional Changes

  • Updated type definitions for storefront entities
  • Added utility functions for cart and product operations
  • Updated TypeScript configuration
  • Updated dependencies (embla-carousel packages)

Changeset

  • Changeset added (docs)

Test Plan

wcole1-godaddy and others added 13 commits November 6, 2025 23:29
- Add ProductGrid and ProductCard components for displaying SKU groups
- Add Badge and Card UI components
- Update GraphQL queries to fetch SKU groups with mediaObjects
- Display product images from mediaObjects (IMAGE type)
- Add formatCurrency utility function
- Create example store page in Next.js app
- Add providers setup for React Query

Amp-Thread-ID: https://ampcode.com/threads/T-65ac7bb2-a629-4360-a457-dddb0eb691c8
Co-authored-by: Amp <amp@ampcode.com>
…refront-product-grid

# Conflicts:
#	examples/nextjs/app/checkout.tsx
#	examples/nextjs/app/providers.tsx
#	examples/nextjs/package.json
#	packages/react/package.json
#	packages/react/src/godaddy-provider.tsx
#	packages/react/src/lib/godaddy/godaddy.ts
#	packages/react/src/lib/godaddy/graphql-env.ts
#	packages/react/src/lib/utils.ts
#	pnpm-lock.yaml
@pbennett1-godaddy pbennett1-godaddy requested a review from a team as a code owner November 11, 2025 19:24
@changeset-bot
Copy link

changeset-bot bot commented Nov 11, 2025

🦋 Changeset detected

Latest commit: 69b0029

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@godaddy/react Patch
nextjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

pbennett1-godaddy and others added 2 commits November 11, 2025 13:31
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
matchedSkus.length === 1 ? matchedSkus[0]?.node?.id : null;

// Query individual SKU details when exactly one SKU matches
const { data: individualSkuData, isLoading: isSkuLoading } = useQuery({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We won't need this once the proper filterig is in place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think we need an individually query? or can we grab all of the data we need in the skus query as well? do we want to do that? since we'll be grabbing inventory/prices/media/etc?

Copy link
Contributor

@wcole1-godaddy wcole1-godaddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@wcole1-godaddy wcole1-godaddy merged commit f4f79d6 into main Nov 13, 2025
3 checks passed
@wcole1-godaddy wcole1-godaddy deleted the storefront-product-grid branch November 13, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants